-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor config to load on init #202
Conversation
README.md
Outdated
| Variable | Description | Required | | ||
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | ||
| PUBLIC_URL | URL for the FilmDrop UI. Useful when using a CDN to host application. | Optional | | ||
| VITE_APP_NAME | Name for this app. (set in `.env`, because it is needed prior to any JS loading) | Optional | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should split this table into the one config needed in .env and the others used in config.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also move the two required config variables to the top of the list. Also wondering if it would be worth handling the behavior when the scene tiler isn't defined more gracefully so that it's not required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I've not split the table into two, one for .env and one for config.json
- I've moved the required var to the top (only one now)
- I've removed the required flag for the
SCENE_TILER_URL
var since it is generally gracefully handled after refactor from consolidate map functions out of search.js component. I've only needed to remove the console log, not ifSCENE_TILER_URL
not set, it will still highlight footprint but close loading spinner and not try to load overlay
import { showApplicationAlert } from '../utils/alertHelper' | ||
|
||
export async function LoadConfigIntoStateService() { | ||
await fetch(`/config/config.json`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this going to work right if the ui is deployed somewhere other than the root, e.g., if it's deployed at http://www.example.com/foo
instead of http://www.example.com/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it should work just fine since the fetch is using a relative URL path that starts with /. This means it will request the file from the root of the domain, regardless of what path the React app is deployed to
Related Issue(s):
Proposed Changes:
src/assets/config.js
to./public/config/config.json
VITE
(leftover from when they were .env vars)default.js
file to only be shared, static values (also clean up dead code here)BONUS: add leaflet-draw types & fixed a11y error in launchModal
To Test:
Test new config
/public/config/config.example.json
for new formatconfig
with file namedconfig.json
to/public
folderconfig.js
file so it does not get committed by accident if adding new commitsnpm run start
like normal to load appTest no config
config.json
filePR Checklist: